package com.csdj.x315springboot.controller;

import com.csdj.x315springboot.common.WebResult;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

@Controller
public class TestController {


    @GetMapping("/index")
    public String index(HttpServletRequest request){
        HttpSession session = request.getSession();
        String id = session.getId();
        System.out.println(id);
        return "/index";
    }

    @ResponseBody
    @GetMapping("/test")
    public WebResult test(){
      return   new WebResult(1)
                .putData("data","msg")
                .putData("age",22)
                .putData("address","cs")
                .putData("name","cloud");
    }
}
